package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/2c81f88ecd5a4cc395b5308a99afbbec?tpId=37&tqId=21315&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/3/8 20:04
 **/
public class StringNumberLong {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            char[] arr = str.toCharArray();

            String numStr = "";
            String m = "";
            String res = "";
            int maxLength = 0;
            for(int i=0;i<arr.length;i++) {
                char c = arr[i];
                if(c >= '0' && c <= '9') {
                    numStr += c;
                } else {
                    if(!numStr.equals("")) {
                        if(numStr.length() > m.length()) {
                            m = numStr;
                            res = m;
                            maxLength = m.length();
                        }else if(numStr.length()==m.length()) {
                            res += numStr;
                        }

                        numStr = new String("");
                    }
                }
            }

            if(numStr.length() > m.length()) {
                m = numStr;
                res = m;
                maxLength = m.length();
            }else if(numStr.length()==m.length()) {
                res += numStr;
            }

            System.out.println(res + "," + maxLength);
        }
    }

}
